<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp" %>

<fmt:message key="integrat_menu_1" var="integrat_menu_1"/>
<fmt:message key="integrat_menu_2" var="integrat_menu_2"/>

    <script>
		if(${subjectCount} ==0){
			alert("你没有相应的BI主题可以查看！");
			window.location = "${lastPage}";
		}
		
		function checkip(ip) {
			var re = /^(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])$/;
			if(!re.test(ip)) {  
				alert("访问失败，请检查BI门户设置是否正确。");
			    return false;
			}
			return true;
		}
		
		
	</script>
		<link rel="StyleSheet" href="../../themes/${sessionScope.loginUser.theme}/dtree/dtree.css" type="text/css" />
		<script type="text/javascript" src="../../scripts/dtree/dtree.js"></script>
		<table>
			<tr>
				<td width=300>
				<div class="dtree" id="list_addressContact" style="height: 450px; overflow-y:auto"> 
					${integrat_menu_1 }<a href="../../components/k3/QvPluginSetup.exe" style="color:red">${integrat_menu_2 }</a>
				<script type="text/javascript">
						d = new dTree('d');
						d.add(0,-1,'');
						//add(id, pid, name, url, title, target, icon, iconOpen, open)
						<c:forEach var="subj" items="${ subjects}">
						var node = new Node("${subj.subjectId}", "${subj.parentId}", "${subj.subjectName}","javascript:showBi(\'${subj.qvwFileName}\',\'${subj.biUserId}\')","${subj.subjectName}");
						<c:if test="${not empty subj.qvwFileName}">
							node.icon = "../../themes/${sessionScope.loginUser.theme}/images/leaf.gif";
						</c:if>
						d.aNodes[d.aNodes.length] = node;
						</c:forEach>
						document.write(d);
						d.openAll();
						var title = document.title;
						function showBi(qvwFileName, biUserId){
							if(qvwFileName !=""){
								if (checkip('${biIp }')) {
									$("iframeBI").src = "qvp://${biIp }/Acct/" + qvwFileName + "?UserID=" + biUserId;
								}
							}
						}
					</script>
					
				</div>
				</td>
			</tr>
		</table>